package com.tg.demo.controller;

import com.tg.demo.service.IAsyncDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.concurrent.Executor;

/**
 * @author Rubble
 * @date 2020/7/31
 */
@RestController
public class WelcomeController {

    @Autowired
    private IAsyncDemoService asyncDemoService;

    @Resource
    Executor executor;

    @GetMapping("/")
    public String welcome(){
        for (int i = 0; i < 10000; i++) {
            asyncDemoService.process(String.valueOf(i));
            System.out.println("async "+i);
        }
        System.out.println("task done.");
        return "welcome  "+System.currentTimeMillis();
    }

}
